<?php
$bookable = new BWMessage($bookableId);
$priceAjustTable = new BASheet('priceAdjust', $bookable);
$priceAdjustView = $priceAjustTable->getView();
?>

<table class="table table-hover">
    <thead>
        <tr>
            <th>
                <input type="checkbox"  id="selectAll"> 
            </th>
            <th><?php echo '最后价格'; ?></th>
            <th><?php echo '调整方式'; ?></th>
            <th><?php echo '调整量'; ?></th>
            <th><?php echo '定义名'; ?></th>
            <th><?php echo '操作'; ?></th>
        </tr> 
    </thead>
    <fieldset>
        <tbody>
            <?php
            foreach ($priceAdjustView as $list) {
                $name = $list->getItem('name')->getValue();
                $description = $list->getItem('description')->getValue();
                $adjustAmount = $list->getItem('adjustAmount')->getValue();
                $adjustMode = $list->getItem('adjustMode')->getValue();
                $price =  $list->getItem('finalPrice')->getValue();
                $adjustModeAlias = BAPriceAdjust::getAdjustModeAlias($adjustMode);
                ?>
                <tr>
                    <td><label class="checkbox">
                            <input type="checkbox" name="checkbox[]" value="<?php echo $list->getId(); ?>"> 
                        </label></td>
                    <td> <?php echo $price; ?> </td>
                    <td> <?php echo $adjustModeAlias; ?> </td>  
                    <td> <?php echo $adjustAmount; ?> </td>  
                    <td> <?php echo $name; ?> </td>  
                    <td><?php
                        echo $control->getAjaxLink(array('name' => '管理', 'id' => 'showAddPriceAdjust'), array(
                            'bookableId' => $bookableId,
                            'priceAdjustId' => $list->getId()
                        ));
                    echo " | ";
                        echo $control->getAjaxLink(array('name' => '删除', 'id' => 'deletePriceAdjust'), array(
                            'bookableId' => $bookableId,
                            'priceAdjustId' => $list->getId()
                        ));
                        ?></td>
                </tr>
            <?PHP } ?>
        </tbody>
    </fieldset>
</table>
<div>
    <?php
    echo $control->getAjaxLink(array('name' => '新增价格调整', 'id' => 'showAddPriceAdjust'), array(
        'htmlOptions' => array('class' => 'btn'),
        'bookableId' => $bookableId,
        'priceAdjustId' => 0
    ));
    ?>
</div>